package net.xxcxcxcx.xc_enhancedmob.event;

import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.ActionResult;
import net.xxcxcxcx.xc_enhancedmob.skills.Ref;

/**
 * 主动技能事件
 */
public interface onTreatCallback {
    Event<onTreatCallback> EVENT = EventFactory.createArrayBacked(onTreatCallback.class,
            (listeners) -> (mobEntity, amount) -> {
                for (onTreatCallback listener : listeners) {
                    ActionResult result = listener.onTreat(mobEntity, amount);
                    if (result != ActionResult.PASS) {
                        return result;
                    }
                }
                return ActionResult.PASS;
            }
    );

    ActionResult onTreat(LivingEntity livingEntity, Ref<Float> amount);

}
